home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / infosrvr / dev / www_talk.930 / 000779_mvanheyn@cs.indiana.edu _Mon Mar 22 21:15:07 1993.msg < prev    next >
Internet Message Format  |  1994-01-24  |  2KB

  1. Return-Path: <mvanheyn@cs.indiana.edu>
  2. Received: from dxmint.cern.ch by  nxoc01.cern.ch  (NeXT-1.0 (From Sendmail 5.52)/NeXT-2.0)
  3.     id AA01179; Mon, 22 Mar 93 21:15:07 MET
  4. Received: from moose.cs.indiana.edu by dxmint.cern.ch (5.65/DEC-Ultrix/4.3)
  5.     id AA12981; Mon, 22 Mar 1993 21:33:38 +0100
  6. Received: from localhost by moose.cs.indiana.edu
  7.     (5.65c/9.4jsm) id AA00891; Mon, 22 Mar 1993 15:33:16 -0500
  8. From: Marc VanHeyningen <mvanheyn@cs.indiana.edu>
  9. To: Putz.parc@xerox.com
  10. Cc: www-talk@nxoc01.cern.ch
  11. Subject: Re: using perl for W3 servers 
  12. In-Reply-To: Your message of "Mon, 22 Mar 1993 11:25:56 PST."
  13.              <93Mar22.112603pst.58466@spoggles.parc.xerox.com> 
  14. Date: Mon, 22 Mar 1993 15:33:16 -0500
  15. Message-Id: <888.732832396@moose.cs.indiana.edu>
  16. Sender: mvanheyn@cs.indiana.edu
  17.  
  18. Thus wrote: 
  19. >I have a couple of HTML servers written in perl, running
  20. >under SunOS Unix, invoked via inetd.
  21. >
  22. >Is there a way in perl to find out the internet address of the client?
  23. >Or do I have to give up the convenience of inetd to do that?
  24.  
  25. I have an HTTP server written in perl, under SunOS Unix, as a
  26. standalone daemon without inetd.  I considered inetd but am of the
  27. opinion that the performance would be unacceptable if perl had to
  28. parse the whole thing for every request.  Forks are not that expensive
  29. in perl, and probably will be faster once we convert to a OpSys with
  30. copy-on-write.  Thus, the code from mine looks more or less like the
  31. code on page 345 of the Camel book.  It's running; URL
  32. http://cs.indiana.edu/ if you want to peek.  I plan to release the
  33. code once it's stable, though people can have unstable copies if they
  34. really want.
  35.  
  36. The following code is taken from page 153 of the Camel book, and
  37. probably does what you want:
  38.  
  39.   $sockaddr = 'S n a4 x8';
  40.   $mysockaddr = getsockname(S);
  41.   ($family, $port, $myaddr) = unpack($sockaddr, $mysockaddr);
  42.  
  43. - Marc
  44. --
  45. Marc VanHeyningen   mvanheyn@cs.indiana.edu   MIME & RIPEM accepted
  46. De Gaulle remark[s ...] about the American "will to power, cloaking itself in
  47. idealism."  By now, this will to power is not so much cloaked in idealism as
  48. it is drowned in fatuity.        - Chomsky